<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="author" content="featon inc.">
    <link rel="stylesheet" href="/static/vendor/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/vendor/bootstrap/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/static/vendor/font-awesome/css/font-awesome.min.css">
    <link href="/static/vendor/jquery-easyui/themes/default/tree.css" rel="stylesheet">
    <link href="/static/vendor/jquery-easyui/themes/icon.css" rel="stylesheet">
    <link href="/static/vendor/jquery-ui/themes/base/jquery.ui.all.css" rel="stylesheet">
    <link rel="stylesheet" href="/static/vendor/skin/ftskin.css">

    <title></title>
</head>

<body style="margin-bottom: 60px;">
<div class="ft-subpage-wrapper container-fluid">

    <!-- 左导航开始	-->
    <div id="ftsidebar-subpage" style="overflow:auto;" class="">
        <div class="leftTree-box">
            <ul id="leftTree" class="easyui-tree" animate="true">

            </ul>
        </div>
    </div>
    <!-- 左导航结束	-->

</div>
<div class="iframe-bottom-tools-box nav navbar-fixed-bottom">
    <button type="button" class="btn btn-info"  id="save_but"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> 保存</button>
    <button type="button" class="btn btn-warning" onclick="modelWindow.closeFrameWindow();"><span class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span> 取消</button>
</div>
<input type="hidden" th:id="handle_name" th:value="${handle_name}" />
<input type="hidden" th:id="update_status" th:value="${update_status}" />
<script src="/static/vendor/jquery/jquery-2.1.3.min.js"></script>
<script src="/static/vendor/bootstrap/js/bootstrap.min.js"></script>

<script src="/static/vendor/jquery-ui/minified/jquery-ui.min.js"></script>
<script src="/static/vendor/jquery-easyui/jquery.easyui.min.js"></script>

<link rel="stylesheet" href="/static/vendor/custom-scrollbar/jquery.mCustomScrollbar.min.css">

<script src="/static/vendor/skin/js/ft-ui.js"></script>
<script src="/static/vendor/skin/js/tree-util.js"></script>
<script src="/static/vendor/skin/js/java.js"></script>
<script src="/static/vendor/skin/js/jquery.c.js"></script>
<script>
    var handle_name = $("#handle_name").val();
    var update_status = $("#update_status").val();
    $(document).ready(function(){
        initMenuTree();
        top.ajax.simple("/operate/getOperateTreeJsonStr/1",{},setMenuTreeJsonData);

        $('#save_but').click(fnSelect)
    });

    function setMenuTreeJsonData(json)
    {
        setLeftMenuTreeJsonData(json);
        setSelectedRoleIDS();
    }

    function initMenuTree()
    {
        $('#leftTree').tree({
            checkbox: true
        });
    }

    //调用父窗口方法,取到已选择过的权限ID,并让树节点选中
    function setSelectedRoleIDS()
    {
        var opt_ids = top.getCurrentFrameObj().getSelectedRoleIDS();

        if(opt_ids != "" && opt_ids != null)
        {
            var tempA = opt_ids.split(",");
            for(var i=0;i<tempA.length;i++)
            {
                $("div[node-id='"+tempA[i]+"'] .tree-checkbox").removeClass("tree-checkbox0").addClass("tree-checkbox1");
            }
        }
    }


    function fnSelect()
    {
        eval("top.getCurrentFrameObj()."+handle_name+"('"+getLeftMenuChecked()+"')");
        modelWindow.closeFrameWindow();
    }
</script>
</body>
</html>
